//
//  WKStockHeaderTableViewCell.m
//  XTXOneToOne
//
//  Created by Canny on 2018/11/20.
//  Copyright © 2018年 WK. All rights reserved.
//

#import "WKStockHeaderTableViewCell.h"

@interface WKStockHeaderTableViewCell ()

@property (nonatomic,strong)UILabel * lab_1;//0.031552
@property (nonatomic,strong)UILabel * lab_2;//≈1367.17CNY

@property (nonatomic,strong)UILabel * lab_high;
@property (nonatomic,strong)UILabel * lab_low;
@property (nonatomic,strong)UILabel * lab_M;


@end


@implementation WKStockHeaderTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self){
        [self initView];
    }
    return self;
}

-(void)setLab:(UILabel *)lab withColor:(UIColor *)color andFont:(CGFloat)font andText:(NSString *)text andTextAlignment:(NSTextAlignment)textAlignment{
    lab.text=text;
    lab.textColor=color;
    lab.font=[UIFont systemFontOfSize:font];
    lab.textAlignment=textAlignment;
}


- (void)initView{
    
    self.backgroundColor=[UIColor clearColor];
    
    _lab_1 = [[UILabel alloc]init];
    [self addSubview:_lab_1];
    [self setLab:_lab_1 withColor:RGB(4, 192, 135) andFont:25 andText:@"加载中" andTextAlignment:NSTextAlignmentLeft];
    [_lab_1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top).offset(10);
        make.left.equalTo(self.mas_left).offset(15);
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(30);
    }];
    
    _lab_2 = [[UILabel alloc]init];
    [self addSubview:_lab_2];
    [self setLab:_lab_2 withColor:RGB(109, 134, 168) andFont:12 andText:@"加载中" andTextAlignment:NSTextAlignmentLeft];
    [_lab_2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.lab_1.mas_bottom).offset(10);
        make.left.equalTo(self.lab_1.mas_left).offset(0);
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(30);
    }];
    
    UILabel * high = [[UILabel alloc]init];
    [self addSubview:high];
    [self setLab:high withColor:RGB(109, 135, 168) andFont:12 andText:@"高" andTextAlignment:NSTextAlignmentRight];
    [high mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.lab_1.mas_top).offset(0);
        make.right.equalTo(self.mas_right).offset(-120);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(20);
    }];
    
    _lab_high = [[UILabel alloc]init];
    [self addSubview:_lab_high];
    [self setLab:_lab_high withColor:RGB(109, 135, 168) andFont:12 andText:@"加载中" andTextAlignment:NSTextAlignmentRight];
    [_lab_high mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(high.mas_top).offset(0);
        make.right.equalTo(self.mas_right).offset(-20);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
    
    UILabel * low = [[UILabel alloc]init];
    [self addSubview:low];
    [self setLab:low withColor:RGB(109, 135, 168) andFont:12 andText:@"低" andTextAlignment:NSTextAlignmentRight];
    [low mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(high.mas_bottom).offset(0);
        make.right.equalTo(high.mas_right).offset(0);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(20);
    }];
    
    _lab_low = [[UILabel alloc]init];
    [self addSubview:_lab_low];
    [self setLab:_lab_low withColor:RGB(109, 135, 168) andFont:12 andText:@"加载中" andTextAlignment:NSTextAlignmentRight];
    [_lab_low mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(low.mas_top).offset(0);
        make.right.equalTo(self.mas_right).offset(-20);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
    
    UILabel * liang = [[UILabel alloc]init];
    [self addSubview:liang];
    [self setLab:liang withColor:RGB(109, 135, 168) andFont:12 andText:@"24H" andTextAlignment:NSTextAlignmentRight];
    [liang mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(low.mas_bottom).offset(0);
        make.right.equalTo(low.mas_right).offset(0);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(20);
    }];
    
    _lab_M = [[UILabel alloc]init];
    [self addSubview:_lab_M];
    [self setLab:_lab_M withColor:RGB(109, 135, 168) andFont:12 andText:@"加载中" andTextAlignment:NSTextAlignmentRight];
    [_lab_M mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(liang.mas_top).offset(0);
        make.right.equalTo(self.mas_right).offset(-20);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
}


+(CGFloat)computeHeight:(id)info{
    return 80;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
